package cn.com.qiancheng.dao;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

import cn.com.qiancheng.util.DbUtil;

public class AddClassDao {
	public int addClass(String stuClass){
		int i = 0;
		try {
			Connection con = DbUtil.openConnection();
			String sql = "INSERT INTO t_class(c_name) VALUES(?)";
			PreparedStatement stat = con.prepareStatement(sql);
			stat.setString(1, stuClass);
			i = stat.executeUpdate();
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} finally {
			try {
				DbUtil.closeConnection();
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		return i;
	}
}
